﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace WebDummy
{
    class Statistics : Fetch
    {
        public Statistics(String Webpage) : base(Webpage)
        {

        }

        public int getrank(String Name,String Webpage = "")
        {
            try
            {
                String Page = FetchPage(Webpage);
                Regex Derp = new Regex("spieler\\.php\\?uid=[0-9]+\\\">" + Name + "(?=</a>)");
                Regex UID = new Regex("(?<=uid\\=)[0-9]+");
                if (Derp.IsMatch(Page))
                    return int.Parse(UID.Match(Derp.Match(Page).Value).Value);
                else
                    return -1;
            }
            catch (Exception Exc)
            {
                throw Exc;
            }
        }
    }
}
